The implementation of the responsive layout relies on media query (Queries) to implement, choose the mainstream device width size as a breakpoint to write extra style to fit, but this will be more troublesome, can only be selected in a few mainstream device size to render the perfect fit. Even with REM units, it is necessary to embed a script to dynamically compute the root element size.
This article mainly and everybody introduced the pure CSS3 uses the VW
[Frontend NLP white learning path] css3 Adaptive Layout Unit (vw). How much do you know about this ?, Css3vw
Viewport units)
What is a viewport?
On the desktop side, the view refers to the desktop side and the visible area of the browser. On the mobile side, the view involves three views: Layout Viewport (Layout View ), visual Viewport and Ideal Viewport ).
In the unit of the view, the desktop refers to the visible area of the browser, and the mobile
One, n more chatterSome of the new units in the CSS3 were introduced in the spring of last year, see: CSS length values and time, frequency, and angle units. Obviously, it mentions the unit VW, VH, which is to be lamented in this article, see:But "I see you" is not the same as "I Touch You". Coincidentally, a coincidence, recently with these two units to see. Roughly, it seems that the VH unit can achieve the overall highly adaptive layout I had previ
1, px: pixel, accurate display2, EM: Inherit the size of the parent font, equivalent to "times", such as: the browser default font size is 16px=1em, always follow the font size of Div inheritance, entry for mobileEM conversion Tool: http://www.runoob.com/tags/ref-pxtoemconversion.html3. REM: Similar to EM, REM is the attribute of the inherited root node (that is, the 4. VH: 1%=1VH of the current visible heightThe difference is: when there is no content in the Div, height=100%, the height is not
One, CSS length value
em
relative to the parent element's font size
ex
height relative to lowercase "x"
gd
Generally used in East Asian typography, this is not related to English
rem
relative to the root element font size
VW
relative to the view Window width: Window width is 100vw
vh
relative to the window heigh
First, equipment support situationTest site: https://caniuse.com/#search =VWCss3test:https://airen.github.io/css3test/,https://github.com/airen/css3test1, PC-side2. Mobile TerminalSecond, the shortage of VWFor example, when the container uses the VW unit, the margin uses PX units, it is easy to cause the overall width of more than 100VW, thus affecting the layout effect. For similar phenomena, we can use the relevant technology to circumvent. For exam
One, n more chatterSome of the new units in the CSS3 were introduced in the spring of last year, see: CSS length values and time, frequency, and angle units. Obviously, it mentions the unit VW, VH, which is to be lamented in this article, see:But "I see you" is not the same as "I Touch You". Coincidentally, a coincidence, recently with these two units to see. Roughly, it seems that the VH unit can achieve the overall highly adaptive layout I had previ
This article mainly introduces the use of CSS3 new unit VW, VH tutorial, this article through the example code to introduce the meaning of VW, VH, Vmin, Vmax and the difference between VW, VH and% percent, interested friends to see it together
Units for responsive layouts the first time we would think of a REM unit for adaptation, but it also needs to embed a sc
The length unit mainly has the following kinds of EM ex ch REM VW VH vm cm mm in pt pc px%, presumably can be divided into several "absolute units" and "relative units" and "percent units".
Absolute unit: px in cm mm
Relative unit: EM rem pt PC EX CH
Percent unit: VW VH VM%
The following mainly say a few commonly used units
PX: Absolute Unit, page by ex
This time to bring you CSS3 new unit VW, VH, vmin, Vmax should be how to use, CSS3 new unit VW, VH, vmin, Vmax use of attention to what matters, the following is the actual case, together to see.
This article introduces the CSS3 new unit VW, VH, Vmin, Vmax of the use of detailed, share to everyone, specifically as follows:
Meaning of 1,
The implementation of the responsive layout relies on media query (Queries) to implement, choose the mainstream device width size as a breakpoint to write extra style to fit, but this will be more troublesome, can only be selected in a few mainstream device size to render the perfect fit. This paper mainly introduces the relevant data of pure CSS3 using VW and VH to realize the adaptive method, hoping to help everyone.
Even with REM units, it is nece
meaning of 1,VW, VH, vmin, Vmax(1)VW,vh,vmin,Vmax is a kind of window unit, is also a relative unit. It is relative to either the parent node or the root node of the page. Instead, it is determined by the size of the window (Viewport), Unit 1, which represents similar to 1%. windows (Viewport) is the area where your browser actually displays content-in other words, your web browser that does not include t
When dealing with mobile pages, we sometimes need to make the banner diagram a wide square with the screen to get the best experience, such as the Flipbord mobile page: So how do you use pure CSS to make a square that can fit the size? Scenario One: CSS3 VW unit CSS3 has a new set of length units relative to the viewable area as a percentage of VW, VH, Vmin, Vmax. Where
According to the CSS3 specification, the viewport units consist mainly of the following 4:
VW:1VW equals 1% of viewport width
VH:1VH equals 1% of the viewport height
Vmin: Choose the smallest of VW and VH
Vmax: Pick the biggest one in VW and VH
Measured in viewport units, viewport width 100vw, height 100vh (vertical screen on the left, h
the problem that needs to be solved at present. At this time, C3 in a new length unit--VW. The description of this unit is: relative to the width of the viewport. Viewport is divided into 100 units of VW, that is, in the 375-width screen, 1vw equals 3.75px,320 screen, 1vw equals 3.2px. So for different sizes of the screen has a unified unit to measure, then we combine REM, that is, the HTML font size FONT-
-size:62.5%;
}
@media only screen and (min-width:481px) {
HTML {
Font-size:94%!important;
}
}
@media only screen and (min-width:561px) {
HTML {
Font-size:109%!important;
}
}
@media only screen and (min-width:641px) {
HTML {
Font-size:125%!important;
}
}
body{
font-size:12px;
Font-size:1.2rem; 12÷10=1.2
}
p{
font-size:14px;
Font-size:1.4rem;
}
For example, you need to specify a specification for the width of the design,
This is done to enable high-definition display on the mobile side. I ha
Method for Processing Mobile Adaptive Layout-calc () and vw, calcvw
When processing mobile adaptive la s, the most popular front-end method should be to use media queries to set the HTML font size, and then set the Dom width and height in the unit of rem, the advantage of this method is that it has good compatibility. The disadvantage is that there are too many different models on the current market and there are many types of dimensions. Therefore, t
1.rem and EM, pxfirst of all, the EM and px relationship em refers to the font height of the browser default 1em=16px, so 0.75em=12px; we often see the font-size:65% of the root element written on the page, so that EM becomes 16px*62.5=10em; this is the font size that is displayed on the page is 10px;So 12px=1.2em,10px=1em, which means you just need to divide your original PX value by 10, and then put EM in as the unit on the line,Characteristics of EMEM is a relative value he will change accord
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.